# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dnscan
pkgver=209.281721e
pkgrel=2
pkgdesc='A python wordlist-based DNS subdomain scanner.'
arch=('any')
groups=('blackarch' 'blackarch-scanner')
url='https://github.com/rbsec/dnscan'
license=('GPL3')
depends=('python' 'python-dnspython' 'python-netaddr' 'python-cryptography')
makedepends=('git')
source=("git+https://github.com/rbsec/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.md

  rm LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat >> "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd "/usr/share/$pkgname"
exec python $pkgname.py "\$@"
EOF
  chmod +x "$pkgdir/usr/bin/$pkgname"
}

